import { base } from '@/config'
import http from '@/utils/request'

// 菜单模块
const menu = {
  getList: () => {
    return http.get(`${base.system}/navigation/getList`)
  },
  // 查询上级菜单
  getNavsSelect: () => {
    return http.get(`${base.system}/navigation/getNavsSelect`)
  },
  // 菜单权限
  getNavs: () => {
    return http.get(`${base.system}/navigation/getNavs`)
  },
  // 获取详情
  getDetail: id => {
    return http.get(`${base.system}/navigation/details/${id}`)
  },
  // 新增
  add: params => {
    return http.postJson(`${base.system}/navigation/add`, params)
  },
  // 编辑
  update: params => {
    return http.postJson(`${base.system}/navigation/update`, params)
  },
  // 删除
  delete: id => {
    return http.post(`${base.system}/navigation/delete/${id}`)
  },
  // 更新状态
  updateEnable: ({ id, status }) => {
    return http.post(`${base.system}/navigation/updateEnable/${id}/${status}`)
  }
}

export default menu
